<?php

$conn = new Com("ADODB.Connection"); //实例化一个Connection对象 
$connstr = "provider=sqloledb;datasource=.;uid=sa;pwd=HWSp29qCGEAHBmfnah;database=test;"; 
$conn->Open($connstr); 

$conn->Execute('insert into test (id) values(12) '); 
$conn->Execute('update test set id = 3 where id =12 '); 
$conn->Execute('delete from test where id =1 '); 
$rs=$conn->Execute('select * from test '); 
$num_columns = $rs->Fields->Count();
for ($i=0; $i < $num_columns; $i++) {
    $fld[$i] = $rs->Fields($i);
}
$rowcount = 0;
while (!$rs->EOF) {
    for ($i=0; $i < $num_columns; $i++) {
        echo $fld[$i]->value . "\t";
    }
    echo "\n";
    $rowcount++;            // increments rowcount
    $rs->MoveNext();
}


echo "共有{$rowcount}条纪录<br />"; 
?>